package com.qifeng.modules.orderInfo.repository;

import com.qifeng.modules.orderInfo.domain.OrderInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by if on 2017/11/22.
 */
@Repository
public interface OrderInfoRepository extends JpaRepository<OrderInfo, Long>, JpaSpecificationExecutor<OrderInfo> {

    @Query(value = "select new com.qifeng.modules.orderInfo.domain.OrderInfoVo(u,o) from UserInfo u inner join OrderInfo o on u.id = o.userId where o.postId = ?1")
    List<OrderInfo> findByPostId(Integer id);
}

